﻿#region NameSpaces
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
#endregion

public partial class Search_Selection : System.Web.UI.Page
{
   
    List<string> CheckedboxItems = new List<string>();

    List<string> QueryColumncollection = new List<string>();


    protected void Page_Load(object sender, EventArgs e)
    {
    List<string>  checkItem =(List<string>) Session["CheckedItem"];

    for (int k = 0; checkItem.Count > k; k++)
    {
        if (checkItem[k].ToString() == "Material")
        {
            trMaterial.Visible = true;
        }

        if (checkItem[k].ToString() == "ashanal")
        {
            trAshAnalysis.Visible = true;
        }

        if (checkItem[k].ToString() == "calanal")
        {
            trCalorificAnalysis.Visible = true;
        }

        if (checkItem[k].ToString() == "proxanal")
        {
            trProximateAnalysis.Visible = true;
        }

        if (checkItem[k].ToString() == "ultanal")
        {
            trUltimateAnalysis.Visible = true;
        }

        if (checkItem[k].ToString() == "struct")
        {
            trStructuralAnalysis.Visible = true;
        }

        if (checkItem[k].ToString() == "convconditions")
        {
            trConversioncond.Visible = true;
        }

        if (checkItem[k].ToString() == "Yields")
        {
            trYield.Visible = true;
        }

        if (checkItem[k].ToString() == "gascomp")
        {
            trGas.Visible = true;
        }

        if (checkItem[k].ToString() == "chrcomp")
        {
            trChr.Visible = true;
        }
        

        if (checkItem[k].ToString() == "liquidcomp")
        {
            trLiquidComponents.Visible = true;
        }

        if (checkItem[k].ToString() == "oilphysprops")
        {
            trOilPhysicalProperties.Visible = true;
        }

        if (checkItem[k].ToString() == "oilcomponents")
        {
            trOilComponents.Visible = true;
        }


        CheckedboxItems.Clear();
       
    }
    }
    
    protected void btnDone_Click(object sender, EventArgs e)
    {
        #region Material Attributes
        //Material table attributes

        if (ChkMaterialHandlingHistory.Checked == true)
        {
            CheckedboxItems.Add(ChkMaterialHandlingHistory.ID);
            QueryColumncollection.Add("material.handlingHistory");
        }
        if (ChkMaterialName.Checked == true)
        {
            CheckedboxItems.Add(ChkMaterialName.ID);
            QueryColumncollection.Add("material.name");
            
        }
        if (ChkMaterialSource.Checked == true)
        {
            CheckedboxItems.Add(ChkMaterialSource.ID);
            QueryColumncollection.Add("material.source");
        }
        #endregion

        #region Conversion Condition Attributes
        //Conversion Condition attributes.

        if (chkConversionConasBiomassRatio.Checked == true)
        {
            CheckedboxItems.Add(chkConversionConasBiomassRatio.ID);
            QueryColumncollection.Add("convconditions.gasBiomassRatio");
        }
        if (chkConversionConBedmedium.Checked == true)
        {
            CheckedboxItems.Add(chkConversionConBedmedium.ID);
            QueryColumncollection.Add("convconditions.bedMedium");
        }
        if (chkConversionConConvRegime.Checked == true)
        {
            CheckedboxItems.Add(chkConversionConConvRegime.ID);
            QueryColumncollection.Add("convconditions.conv_Regime");
        }
        if (chkConversionConFeedRateMax.Checked == true)
        {
            CheckedboxItems.Add(chkConversionConFeedRateMax.ID);
            QueryColumncollection.Add("convconditions.feedRate_max");
        }
        if (chkConversionConFeedRateMin.Checked == true)
        {
            CheckedboxItems.Add(chkConversionConFeedRateMin.ID);
            QueryColumncollection.Add("convconditions.feedRate_min");
        }
        if (chkConversionConFeedsystem.Checked == true)
        {
            CheckedboxItems.Add(chkConversionConFeedsystem.ID);
            QueryColumncollection.Add("convconditions.feedSystem");
        }
        if (chkConversionConGasifimethod.Checked == true)
        {
            CheckedboxItems.Add(chkConversionConGasifimethod.ID);
            QueryColumncollection.Add("convconditions.gasificationMed");
        }
        if (chkConversionConHeatRateMax.Checked == true)
        {
            CheckedboxItems.Add(chkConversionConHeatRateMax.ID);
            QueryColumncollection.Add("convconditions.heatRate_max");
        }
        if (chkConversionConHeatRateMin.Checked == true)
        {
            CheckedboxItems.Add(chkConversionConHeatRateMin.ID);
            QueryColumncollection.Add("convconditions.heatRate_min");
        }
        if (chkConversionConPressure.Checked == true)
        {
            CheckedboxItems.Add(chkConversionConPressure.ID);
            QueryColumncollection.Add("convconditions.pressure");
        }
        if (chkConversionConReactorConf.Checked == true)
        {
            CheckedboxItems.Add(chkConversionConReactorConf.ID);
            QueryColumncollection.Add("convconditions.reactorConfig");
        }
        if (chkConversionConResTimeMax.Checked == true)
        {
            CheckedboxItems.Add(chkConversionConResTimeMax.ID);
            QueryColumncollection.Add("convconditions.resTime_max");
        }
        if (chkConversionConResTimeMin.Checked == true)
        {
            CheckedboxItems.Add(chkConversionConResTimeMin.ID);
            QueryColumncollection.Add("convconditions.resTime_min");
        }
        if (chkConversionConSweepGasVol.Checked == true)
        {
            CheckedboxItems.Add(chkConversionConSweepGasVol.ID);
            QueryColumncollection.Add("convconditions.sweptGasVelocity");
        }
        if (chkConversionConTem.Checked == true)
        {
            CheckedboxItems.Add(chkConversionConTem.ID);
            QueryColumncollection.Add("convconditions.temp");
        }

        #endregion

        #region "Analysis"
      
        #region Calorific Analysis

        //Calorfic Analysis Condition Checkboxes.
        if (chkCalorificAnalysisMoistureStatus.Checked == true)
        {
            CheckedboxItems.Add(chkCalorificAnalysisMoistureStatus.ID);
            QueryColumncollection.Add("calanal.moistureStatus");
        }
        if (chkCalorificAnalysisHHV.Checked == true)
        {
            CheckedboxItems.Add(chkCalorificAnalysisHHV.ID);
            QueryColumncollection.Add("calanal.HHV");
        }
        if (chkCalorificAnalysisLHV.Checked == true)
        {
            CheckedboxItems.Add(chkCalorificAnalysisLHV.ID);
            QueryColumncollection.Add("calanal.LHV");
        }

        #endregion

        #region Ash Analysis
        //Ash Analysis Condition Checkboxes

        if (chkAshanalysisAl2O3.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisAl2O3.ID);
            QueryColumncollection.Add("ashanal.Al2O3");
        }

        if (chkAshanalysisProductionMethod.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisProductionMethod.ID);
            QueryColumncollection.Add("ashanal.ashProdMethod");
        }

        if (chkAshanalysisCO2.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisCO2.ID);
            QueryColumncollection.Add("ashanal.CO2");
        }

        if (chkAshanalysisSO3.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisSO3.ID);
            QueryColumncollection.Add("ashanal.SO3");
        }

        if (chkAshanalysisP2O5.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisP2O5.ID);
            QueryColumncollection.Add("ashanal.P2O5");
        }

        if (chkAshanalysisSiO2.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisSiO2.ID);
            QueryColumncollection.Add("ashanal.SiO2");
        }

        if (chkAshanalysisFe2O3.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisFe2O3.ID);
            QueryColumncollection.Add("ashanal.Fe2O3");
        }

        if (chkAshanalysisAl2O3.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisAl2O3.ID);
            QueryColumncollection.Add("ashanal.Al2O3");
        }

        if (chkAshanalysisCaO.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisCaO.ID);
            QueryColumncollection.Add("ashanal.CaO");
        }

        if (chkAshanalysisMgO.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisMgO.ID);
            QueryColumncollection.Add("ashanal.MgO");
        }

        if (chkAshanalysisNa2O.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisNa2O.ID);
            QueryColumncollection.Add("ashanal.Na2O");
        }

        if (chkAshanalysisK2O.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisK2O.ID);
            QueryColumncollection.Add("ashanal.K2O");
        }

        if (chkAshanalysisTiO2.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisTiO2.ID);
            QueryColumncollection.Add("ashanal.TiO2");
        }

        if (chkAshanalysisPb.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisPb.ID);
            QueryColumncollection.Add("ashanal.Pb");
        }

        if (chkAshanalysisCd.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisCd.ID);
            QueryColumncollection.Add("ashanal.Cd");
        }

        if (chkAshanalysisCl.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisCl.ID);
            QueryColumncollection.Add("ashanal.Cl");
        }

        if (chkAshanalysisCu.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisCu.ID);
            QueryColumncollection.Add("ashanal.Cu");
        }

        if (chkAshanalysisHg.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisHg.ID);
            QueryColumncollection.Add("ashanal.Hg");
        }

        if (chkAshanalysisMn.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisMn.ID);
            QueryColumncollection.Add("ashanal.Mn");
        }

        if (chkAshanalysisCr.Checked == true)
        {
            CheckedboxItems.Add(chkAshanalysisCr.ID);
            QueryColumncollection.Add("ashanal.Cr");
        }

        #endregion

        #region Proximate Analysis

        //Proximate analysis attributes
        if (chkProximateAnalysisAsh.Checked == true)
        {
            CheckedboxItems.Add(chkProximateAnalysisAsh.ID);
            QueryColumncollection.Add("proxanal.ash");
        }

        if (chkProximateAnalysisMoistureStatus.Checked == true)
        {
            CheckedboxItems.Add(chkProximateAnalysisMoistureStatus.ID);
            QueryColumncollection.Add("proxanal.moistureStatus");
        }

        if (chkProximateAnalysisMoisture.Checked == true)
        {
            CheckedboxItems.Add(chkProximateAnalysisMoisture.ID);
            QueryColumncollection.Add("proxanal.moisture");
        }

        if (chkProximateAnalysisVolatiles.Checked == true)
        {
            CheckedboxItems.Add(chkProximateAnalysisVolatiles.ID);
            QueryColumncollection.Add("proxanal.volatiles");
        }

        if (chkProximateAnalysisFixedCarbon.Checked == true)
        {
            CheckedboxItems.Add(chkProximateAnalysisFixedCarbon.ID);
            QueryColumncollection.Add("proxanal.fixedCarbon");
        }

        #endregion

        #region Ultimate Analysis
        //Ultimate analysis textboxes
        if (chkUltimateAnalysisMoistureStatus.Checked == true)
        {
            CheckedboxItems.Add(chkUltimateAnalysisMoistureStatus.ID);
            QueryColumncollection.Add("ultanal.moistureStatus");
        }
        if (chkUltimateAnalysisMoisture.Checked == true)
        {
            CheckedboxItems.Add(chkUltimateAnalysisMoisture.ID);
            QueryColumncollection.Add("ultanal.moisture");
        }
        if (chkUltimateAnalysisAsh.Checked == true)
        {
            CheckedboxItems.Add(chkUltimateAnalysisAsh.ID);
            QueryColumncollection.Add("ultanal.ash");
        }
        //if (chkUltimateAnalysisAsh.Checked == true)
        //{
        //    CheckedboxItems.Add(chkUltimateAnalysisAsh.ID);
        //    QueryColumncollection.Add("ultanal.ash");
        //}
        if (chkUltimateAnalysisH.Checked == true)
        {
            CheckedboxItems.Add(chkUltimateAnalysisH.ID);
            QueryColumncollection.Add("ultanal.H");
        }
        if (chkUltimateAnalysisC.Checked == true)
        {
            CheckedboxItems.Add(chkUltimateAnalysisC.ID);
            QueryColumncollection.Add("ultanal.C");
        }
        if (chkUltimateAnalysisN.Checked == true)
        {
            CheckedboxItems.Add(chkUltimateAnalysisN.ID);
            QueryColumncollection.Add("ultanal.N");
        }
        if (chkUltimateAnalysisO.Checked == true)
        {
            CheckedboxItems.Add(chkUltimateAnalysisO.ID);
            QueryColumncollection.Add("ultanal.O");
        }
        if (chkUltimateAnalysisCl.Checked == true)
        {
            CheckedboxItems.Add(chkUltimateAnalysisCl.ID);
            QueryColumncollection.Add("ultanal.Cl");
        }
        if (chkUltimateAnalysisS.Checked == true)
        {
            CheckedboxItems.Add(chkUltimateAnalysisS.ID);
            QueryColumncollection.Add("ultanal.S");
        }

        #endregion

        #region Structural Analysis
        //Structualanalysis Attributes
        if (chkStructuralAnalysisLignin.Checked == true)
        {
            CheckedboxItems.Add(chkStructuralAnalysisLignin.ID);
            QueryColumncollection.Add("struct.lignin");
        }
        if (chkStructuralAnalysisLigninMethod.Checked == true)
        {
            CheckedboxItems.Add(chkStructuralAnalysisLigninMethod.ID);
            QueryColumncollection.Add("struct.ligninMethod");
        }
        if (chkStructuralAnalysisCellulose.Checked == true)
        {
            CheckedboxItems.Add(chkStructuralAnalysisCellulose.ID);
            QueryColumncollection.Add("struct.cellulose");
        }
        if (chkStructuralAnalysisHemiCellulose.Checked == true)
        {
            CheckedboxItems.Add(chkStructuralAnalysisHemiCellulose.ID);
            QueryColumncollection.Add("struct.hemicellulose");
        }
        if (chkStructuralAnalysisExtractives.Checked == true)
        {
            CheckedboxItems.Add(chkStructuralAnalysisExtractives.ID);
            QueryColumncollection.Add("struct.extractives");
        }
        if (chkStructuralAnalysisCellWall.Checked == true)
        {
            CheckedboxItems.Add(chkStructuralAnalysisCellWall.ID);
            QueryColumncollection.Add("struct.cellwall");
        }
        if (chkStructuralAnalysisPectin.Checked == true)
        {
            CheckedboxItems.Add(chkStructuralAnalysisPectin.ID);
            QueryColumncollection.Add("struct.pectin");
        }
        if (chkStructuralAnalysisSol_Sugar_Sta.Checked == true)
        {
            CheckedboxItems.Add(chkStructuralAnalysisSol_Sugar_Sta.ID);
            QueryColumncollection.Add("struct.sol_sugars_stch");
        }
        if (chkStructuralAnalysisXylan.Checked == true)
        {
            CheckedboxItems.Add(chkStructuralAnalysisXylan.ID);
            QueryColumncollection.Add("struct.xylan");
        }
        if (chkStructuralAnalysisGlucomannan.Checked == true)
        {
            CheckedboxItems.Add(chkStructuralAnalysisGlucomannan.ID);
            QueryColumncollection.Add("struct.glucomannan");
        }
        if (chkStructuralAnalysisGalactin.Checked == true)
        {
            CheckedboxItems.Add(chkStructuralAnalysisGalactin.ID);
            QueryColumncollection.Add("struct.galactan");
        }
        if (chkStructuralAnalysisArabinan.Checked == true)
        {
            CheckedboxItems.Add(chkStructuralAnalysisArabinan.ID);
            QueryColumncollection.Add("struct.arabinan");
        }
        if (chkStructuralAnalysisMannan.Checked == true)
        {
            CheckedboxItems.Add(chkStructuralAnalysisMannan.ID);
            QueryColumncollection.Add("struct.mannan");
        }

        #endregion

        #endregion

        #region Yield Attributes
        

        if (chkYieldChr.Checked == true)
        {
            CheckedboxItems.Add(chkYieldChr.ID);
            QueryColumncollection.Add("yields.chr");
        }
        if (chkYieldGas.Checked == true)
        {
            CheckedboxItems.Add(chkYieldGas.ID);
            QueryColumncollection.Add("yields.gas");

        }
        if (chkYieldLiquid.Checked == true)
        {
            CheckedboxItems.Add(chkYieldLiquid.ID);
            QueryColumncollection.Add("yields.liquid");
        }
        if (chkYieldTar.Checked == true)
        {
            CheckedboxItems.Add(chkYieldTar.ID);
            QueryColumncollection.Add("yields.tar");
        }
        #endregion

        #region Gas Attributes


        if (chkGasC2H2.Checked == true)
        {
            CheckedboxItems.Add(chkGasC2H2.ID);
            QueryColumncollection.Add("gascomp.C2H2");
        }
        if (chkGasH2.Checked == true)
        {
            CheckedboxItems.Add(chkGasH2.ID);
            QueryColumncollection.Add("gascomp.H2");

        }
        if (chkGasCO.Checked == true)
        {
            CheckedboxItems.Add(chkGasCO.ID);
            QueryColumncollection.Add("gascomp.CO");
        }
        if (chkGasCO2.Checked == true)
        {
            CheckedboxItems.Add(chkGasCO2.ID);
            QueryColumncollection.Add("gascomp.CO2");
        }
        if (chkGasC2H4.Checked == true)
        {
            CheckedboxItems.Add(chkGasC2H4.ID);
            QueryColumncollection.Add("gascomp.C2H4");
        }
        if (chkGasC2H6.Checked == true)
        {
            CheckedboxItems.Add(chkGasC2H6.ID);
            QueryColumncollection.Add("gascomp.C2H6");
        }
        if (chkGasN2.Checked == true)
        {
            CheckedboxItems.Add(chkGasN2.ID);
            QueryColumncollection.Add("gascomp.N2");
        }
        if (chkGasGCV.Checked == true)
        {
            CheckedboxItems.Add(chkGasGCV.ID);
            QueryColumncollection.Add("gascomp.GCV");
        }
        if (chkGasTar.Checked == true)
        {
            CheckedboxItems.Add(chkGasTar.ID);
            QueryColumncollection.Add("gascomp.Tar");
        }
        #endregion

        #region Chr Attributes


        if (chkChrAsh.Checked == true)
        {
            CheckedboxItems.Add(chkChrAsh.ID);
            QueryColumncollection.Add("chrcomp.Ash");
        }
        if (chkChrH.Checked == true)
        {
            CheckedboxItems.Add(chkChrH.ID);
            QueryColumncollection.Add("chrcomp.H");

        }
        if (chkChrN.Checked == true)
        {
            CheckedboxItems.Add(chkChrN.ID);
            QueryColumncollection.Add("chrcomp.N");
        }
        if (chkChrS.Checked == true)
        {
            CheckedboxItems.Add(chkChrS.ID);
            QueryColumncollection.Add("chrcomp.S");
        }
        if (chkChrC.Checked == true)
        {
            CheckedboxItems.Add(chkChrC.ID);
            QueryColumncollection.Add("chrcomp.C");
        }
        
        #endregion

        #region Liquid components Attributes


        if (chkLiquidComponentAqueous.Checked == true)
        {
            CheckedboxItems.Add(chkLiquidComponentAqueous.ID);
            QueryColumncollection.Add("liquidcomp.aqueous");
        }
        if (chkLiquidComponentOil.Checked == true)
        {
            CheckedboxItems.Add(chkLiquidComponentOil.ID);
            QueryColumncollection.Add("liquidcomp.oil");

        }
        if (chkLiquidComponentWater.Checked == true)
        {
            CheckedboxItems.Add(chkLiquidComponentWater.ID);
            QueryColumncollection.Add("liquidcomp.water");
        }
       

        #endregion

        #region Oil components Attributes


        if (chkOilComponentAliphatic.Checked == true)
        {
            CheckedboxItems.Add(chkOilComponentAliphatic.ID);
            QueryColumncollection.Add("oilcomponents.aliphatic");
        }
        if (chkOilComponentAromatic.Checked == true)
        {
            CheckedboxItems.Add(chkOilComponentAromatic.ID);
            QueryColumncollection.Add("oilcomponents.aromatic");

        }
        if (chkOilComponentPolar.Checked == true)
        {
            CheckedboxItems.Add(chkOilComponentPolar.ID);
            QueryColumncollection.Add("oilcomponents.polar");
        }


        #endregion       

        #region Oil physical properties Attributes


        if (chkOilPhysicalPropertiesDensity.Checked == true)
        {
            CheckedboxItems.Add(chkOilPhysicalPropertiesDensity.ID);
            QueryColumncollection.Add("oilphysprops.density");
        }
        if (chkOilPhysicalPropertiesViscosity.Checked == true)
        {
            CheckedboxItems.Add(chkOilPhysicalPropertiesViscosity.ID);
            QueryColumncollection.Add("oilphysprops.viscosity");

        }
        if (chkOilPhysicalPropertiesViscosityTemp.Checked == true)
        {
            CheckedboxItems.Add(chkOilPhysicalPropertiesViscosityTemp.ID);
            QueryColumncollection.Add("oilphysprops.viscosity_temp");
        }

        if (chkOilPhysicalPropertiesFlashPoint.Checked == true)
        {
            CheckedboxItems.Add(chkOilPhysicalPropertiesFlashPoint.ID);
            QueryColumncollection.Add("oilphysprops.flashPoint");
        }

        if (chkOilPhysicalPropertiesPourPoint.Checked == true)
        {
            CheckedboxItems.Add(chkOilPhysicalPropertiesPourPoint.ID);
            QueryColumncollection.Add("oilphysprops.pourPoint");
        }

        if (chkOilPhysicalPropertiesPh.Checked == true)
        {
            CheckedboxItems.Add(chkOilPhysicalPropertiesPh.ID);
            QueryColumncollection.Add("oilphysprops.pH");
        }

        if (chkOilPhysicalPropertiesHHV.Checked == true)
        {
            CheckedboxItems.Add(chkOilPhysicalPropertiesHHV.ID);
            QueryColumncollection.Add("oilphysprops.HHV");
        }

        if (chkOilPhysicalPropertiesHeatOfCompution.Checked == true)
        {
            CheckedboxItems.Add(chkOilPhysicalPropertiesHeatOfCompution.ID);
            QueryColumncollection.Add("oilphysprops.HeatOfCombustion");
        }

        if (chkOilPhysicalPropertiesWaterContent.Checked == true)
        {
            CheckedboxItems.Add(chkOilPhysicalPropertiesWaterContent.ID);
            QueryColumncollection.Add("oilphysprops.WaterContent");
        }

        if (chkOilPhysicalPropertiesContradsenCarbon.Checked == true)
        {
            CheckedboxItems.Add(chkOilPhysicalPropertiesContradsenCarbon.ID);
            QueryColumncollection.Add("oilphysprops.ConradsenCarbon");
        }


        #endregion       

        #region "Session Related"

        Session["SearchCheckedItem"] = CheckedboxItems;

        Session["QueryColumn"] = QueryColumncollection;

        #endregion

        Response.Redirect("FilterData.aspx");
    }
    
}
